public class Animal {
    public String name;
    public int age;

    static{
        System.out.println("Animal::static{}");
    }//静态代码块
    {
        System.out.println("Animal::{}");
    }//实例代码块

    public Animal(String name, int age) {//自动生成构造函数
        this.name = name;
        this.age = age;
        System.out.println("Animal带两个参数的构造函数");
    }

    public Animal(String name) {
        this.name = name;
        System.out.println("Animal带一个参数的构造函数");
    }

    public void eat(){
        System.out.println(this.name + "在吃东西");
    }
}
